// 汽车类
public class Car {
    private String brand;
    private String color;
    private int speed;
    
    public Car(String brand, String color) {
        this.brand = brand;
        this.color = color;
        this.speed = 0;
    }
    
    public void accelerate(int increment) {
        speed += increment;
        System.out.println(brand + "加速到" + speed + "km/h");
    }
    
    public void brake(int decrement) {
        speed = Math.max(0, speed - decrement);
        System.out.println(brand + "减速到" + speed + "km/h");
    }
    
    public void displayInfo() {
        System.out.println("品牌: " + brand + ", 颜色: " + color + ", 速度: " + speed + "km/h");
    }
    
    // getter 和 setter
    public String getBrand() { return brand; }
    public void setBrand(String brand) { this.brand = brand; }
    public String getColor() { return color; }
    public void setColor(String color) { this.color = color; }
    public int getSpeed() { return speed; }
}

// 测试类
public class CarDemo {
    public static void main(String[] args) {
        Car car1 = new Car("Toyota", "红色");
        Car car2 = new Car("Honda", "蓝色");
        
        car1.displayInfo();
        car1.accelerate(30);
        car1.accelerate(20);
        car1.brake(15);
        car1.displayInfo();
        
        car2.displayInfo();
        car2.accelerate(40);
        car2.displayInfo();
    }
}
